﻿using System;
using System.Linq;
using System.Web.Services;
using phudieuhungthinh.BL;

namespace phudieuhungthinh.Admin
{
    public partial class ArticleListPage : System.Web.UI.Page
    {
        [WebMethod(EnableSession = true)]
        public static object GetAll()
        {
            try
            {
                //Get data from database.
                var im = new ArticleImpl();
                var list = im.GetArticles(ArticleType.Article);
                return new { Result = "OK", Records = list, TotalRecordCount = list.Count };
            }
            catch (Exception ex)
            {
                return new { Result = "Error", Message = ex.ToString() };
            }
        }

        [WebMethod(EnableSession = true)]
        public static bool DeleteArticle(int id)
        {
            //delete data from database.
            var im = new ArticleImpl();
            return im.DeleteArticle(id);
        }
    }
}